package com.example.tms.mapper;


import com.example.tms.bean.CarInfo;
import com.example.tms.bean.DeptInfo;
import com.example.tms.bean.OilfillInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Repository
public interface OilfillMapper extends JpaRepository<OilfillInfo,String>, JpaSpecificationExecutor<OilfillInfo> {



    //查询
    @Query(value = "select * from oilfill_info where cph =?1 ", nativeQuery = true)
    List<OilfillInfo> findByCph(String cph);


    //查询
    @Query(value = "select * from oilfill_info where cyid =?1 ", nativeQuery = true)
    OilfillInfo findByCyid(String cyid);

    //计算累计充油金额
//    @Query(value = "select sum(sjcyje) FROM oilfill_info where cph = ?1 ", nativeQuery = true)
//    String sumSjcyje(String cph);

    //填写实际充油金额
//    @Query(value = "update oilfill set sjcyje = ?1 where cyid = ?1", nativeQuery = true)
//    @Modifying
//    @Transactional
//    void updateSjcyje(String sjcyje, String cyid);
}

